package wxshop.web.admin.tools;

import org.apache.http.client.fluent.Request;
import org.apache.http.client.fluent.Response;

/**
 * Created by 121874694@qq.com on 2018/3/4.
 */
public class HttpUtil {
	public static String doPost(String url, String params, String charset)
			throws Exception {
		Request request = Request.Post(url);
		request.bodyByteArray(params.getBytes(charset));
		Response response = request.execute();
		return response.returnContent().asString();
	}
	
	public static String doGet(String url, String charset) throws Exception {
		Request request = Request.Get(url);
		request.setHeader("Content-type", "application/json;charset="+charset);
		Response response = request.execute();
		return response.returnContent().asString();
	}
}
